home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / util / libs / DragnDrop14.lha / Dragndrop_demo.lha / DragnDrop / Display_IFF.p next >
Text File  |  1999-03-30  |  8KB  |  238 lines

  1.     {* NewProc=DisplayIFF[&Name,Modus,ScreenNr,X,Y][A0,LokalMode,LRp,PosLeft,PosTop]*}
  2.     {* IncVar: Lokalmode,Anzahl,Rot,Gruen,Blau,BM_Laenge,BytesperRow,Planes*}
  3.     {* IncVar: BitPlanegroesse,LokalScreen,LRP,BildBreite,Bildhoehe,Skip,MaxHoehe*}
  4.     {* IncVar: PosLeft,PosTop*}
  5.     {* IncSysBlock: Buffer,1024*}
  6.  
  7.     Normal=     0
  8.     Kein_CLS=   1
  9.     Keine_CMAP= 2
  10.     Play_Anim=  3
  11.  
  12. CNOP 0,4
  13. BMHD:
  14. Breite: dc.w 0
  15. Hoehe:  dc.w 0
  16. Posx:   dc.w 0
  17. Posy:   dc.w 0
  18. Tiefe:  dc.b 0
  19. Maske:  dc.b 0
  20. Packart:dc.b 0,0
  21. Trans:  dc.w 0
  22.         dc.b 0,0
  23. PageX:  dc.w 0
  24. PageY:  dc.w 0
  25.  
  26. Bitmap:
  27. BPR:    dc.w 0
  28. Rows:   dc.w 0
  29.         dc.b 0
  30. Tiefe1: dc.b 0
  31.         dc.w 0
  32. plane1: dc.l 0
  33. plane2: dc.l 0
  34. plane3: dc.l 0
  35. plane4: dc.l 0
  36. plane5: dc.l 0
  37. plane6: dc.l 0
  38. plane7: dc.l 0
  39. plane8: dc.l 0
  40.  
  41. Cnop 0,4
  42. DisplayIFF:
  43.     SBlock==0
  44.     DBlock==0
  45.     FH=Open(a0,#Mode_old)
  46.     CheckF FH,.Error
  47.         If Lokalmode=#Normal {   SetRGB32(Viewport,0,0,0,0)
  48.                                  SetAPen(LRp,0)
  49.                                  RectFill(LRp,0,0,639,279) }
  50.         Read(FH,#Buffer,4)
  51.         If Buffer##"FORM" --> .ErrorClose1
  52.         Read(FH,#Buffer,4)
  53.         Read(FH,#Buffer,4)
  54.         If Buffer##"ILBM" --> .ErrorClose1
  55.         Read(FH,#Buffer,4)
  56.         If Buffer##"BMHD" --> .ErrorClose1
  57.         Read(FH,#anzahl,4)
  58.         Read(FH,#BMHD,anzahl)
  59.         Clr.l d0
  60.         If Lokalmode=#PLAY_Anim {
  61.                                   Move.l #44,PosLeft
  62.                                   Move.l #0,PosTop
  63.                                 }
  64.         Move.w Breite,d0
  65.         Move.l d0,BildBreite
  66.         Move.w Hoehe,d0
  67.         Move.l d0,Bildhoehe
  68.         If BildHoehe<MaxHoehe --> .Schleife
  69.         Move.l MaxHoehe,BildHoehe
  70. .Schleife:
  71.         {* Flush *}
  72.         Anzahl=Read(FH,#Buffer,4)
  73.         If Anzahl##4 --> .ende
  74.         Read(FH,#anzahl,4)
  75.         If Buffer=#"CMAP" { 
  76.                             Read(FH,#Buffer,anzahl)
  77.                             If LokalMode=#Keine_CMAP --> .Schleife
  78.                             move.l Anzahl,d7
  79.                             divu.l #3,d7
  80.                             subq.l #1,d7
  81.                             Lea Buffer,a4
  82.                             Moveq.l #-1,d4
  83. .CMAP1:                     Clr.l d1
  84.                             Clr.l d2
  85.                             Clr.l d3
  86.                             addq.l #1,d4
  87.                             move.b (a4)+,d1
  88.                             move.b (a4)+,d2
  89.                             move.b (a4)+,d3
  90.                             ROR.l #8,d1
  91.                             ROR.l #8,d2
  92.                             ROR.l #8,d3
  93.                             SetRGB32(Viewport,D4,D1,D2,D3)
  94.                             If D4##255 --> .Cmap1
  95.                             bra .Schleife
  96.                           }
  97.         If Buffer=#"BODY" { 
  98.                             {* Flush *}
  99.                             SBlock=Allocmem(Anzahl,#MEMF_any)
  100.                             CheckF SBlock,.errorclose1
  101.                             Read(FH,Sblock,anzahl)
  102.                             clr.l d0
  103.                             clr.l d1
  104.                             move.W Breite,d0
  105.                             divu.w #8,d0
  106.                             swap d0
  107.                             cmpi.w #0,d0
  108.                             beq.s .body1
  109.                             addi.l #$00010000,d0
  110. .body1:
  111.                             {* Flush *}
  112.                             swap.w d0
  113.                             andi.l #$FFFF,d0
  114.                             move.l d0,BytesperRow
  115.                             move.w hoehe,d1
  116.                             mulu.l d1,d0
  117.                             clr.w d1
  118.                             move.b Tiefe,d1
  119.                             mulu.l d1,d0
  120.                             move.l d0,BM_laenge                            
  121.                             DBlock=AllocMem(BM_Laenge,#MEMF_ANY)
  122.                             CheckF Dblock,.Errorclose2
  123.                             move.l sblock,a0
  124.                             move.l dblock,a1
  125.                             move.l a1,a2
  126.                             add.l BM_laenge,a2
  127. .Body2:                     clr.w d0
  128.                             cmp.l a1,a2
  129.                             ble.s .Bodyende
  130.                             move.b (a0)+,d0
  131.                             tst.b d0
  132.                             bpl.s .plus           ; nicht gleiche
  133.                             neg.b d0
  134.                             move.b (a0)+,d1
  135. .Body3:                     move.b d1,(a1)+
  136.                             dbra d0,.Body3
  137.                             bra.s .body2
  138. .plus:                      move.b (a0)+,(a1)+
  139.                             dbra d0,.plus
  140.                             bra.s .body2
  141. .Bodyende:                  
  142.                             {* Flush *}
  143.                             Freemem(SBlock,Anzahl)
  144.                             Move.l DBlock,SBlock        ; Tausche Source<->Ziel
  145.                             DBlock=AllocMem(BM_Laenge,#MEMF_Chip)
  146.                             CheckF Dblock,.Errorclose3
  147.                             clr.l d1
  148.                             move.l Bytesperrow,d7
  149.                             Move.l d7,d0
  150.                             move.w Hoehe,d1
  151.                             mulu.l d0,d1
  152.                             move.l d1,BitPlaneGroesse
  153.                             move.l d7,d1
  154. ;                            Lsr.l #2,d7
  155.                             subq.l #1,d7
  156.                             move.l d7,d6
  157.                             clr.l d0
  158.                             move.b tiefe,D0
  159.                             move.l d0,Planes
  160.                             subq.l #1,d0
  161.                             mulu.l d1,d0
  162.                             move.l d0,skip
  163.  
  164.                         For I= 1 to Planes
  165.  
  166.                             Move.l Sblock,a0
  167.                             Move.l I,d0
  168.                             Subq.l #1,d0
  169.                             move.l BytesPerRow,d1
  170.                             mulu.l d1,d0
  171.                             add.l d0,a0
  172.                             Move.l Dblock,a1
  173.                             Move.l I,d0
  174.                             Subq.l #1,d0
  175.                             move.l BitPlanegroesse,d1
  176.                             mulu.l d1,d0
  177.                             add.l d0,a1
  178.                             move.w hoehe,d5
  179.                             subq.l #1,d5
  180. .body5:                     Move.b (a0)+,(a1)+
  181.                             dbra d6,.Body5
  182.                             add.l Skip,a0
  183.                             move.l d7,d6
  184.                             dbra d5,.Body5
  185.  
  186.                         Next I
  187.                         Freemem(sblock,BM_Laenge)
  188.                         If LokalMode##PLAY_Anim {
  189.                                                   Close(FH)
  190.                                                 }
  191.                         move.l BytesperRow,d0
  192.                         move.w d0,BPR
  193.                         move.w hoehe,Rows
  194.                         move.b tiefe,tiefe1
  195.                         Move.l Bitplanegroesse,d0
  196.                         move.l DBlock,a0
  197.                         move.l #plane1,a1
  198.                         move.l a0,(a1)+
  199.                         add.l d0,a0
  200.                         move.l a0,(a1)+
  201.                         add.l d0,a0
  202.                         move.l a0,(a1)+
  203.                         add.l d0,a0
  204.                         move.l a0,(a1)+
  205.                         add.l d0,a0
  206.                         move.l a0,(a1)+
  207.                         add.l d0,a0
  208.                         move.l a0,(a1)+
  209.                         add.l d0,a0
  210.                         move.l a0,(a1)+
  211.                         add.l d0,a0
  212.                         move.l a0,(a1)+
  213.                         BltBitMapRastport(#Bitmap,0,0,LRp,PosLeft,PosTop,BildBreite,Bildhoehe,$C0)
  214.                         Freemem(Dblock,BM_Laenge)
  215.                         If LokalMode=#Play_Anim --> .Schleife
  216.                         RTS
  217.                         }
  218.         Read(FH,#Buffer,anzahl)
  219.         Bra .Schleife          
  220. .Error: Move.l #0,d0
  221.         RTS
  222. .errorClose3:
  223.         {* Flush *}
  224.         FreeMem(Dblock,BM_laenge)
  225.         bra.s .ErrorClose1        
  226. .errorClose2:
  227.         {* Flush *}
  228.         FreeMem(Sblock,Anzahl)
  229. .ErrorClose1:
  230.         {* Flush *}
  231.         Close(FH)
  232.         bra.s .error
  233. .ende:  
  234.         {* Flush *}
  235.         Close(FH)
  236.         RTS
  237.  
  238.